<?php
$path = 'c:/wamp/lib/';
define(PROJECT_DIR, 'c:/wamp/www/generador2/');
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
set_include_path(get_include_path() . PATH_SEPARATOR . PROJECT_DIR . "lib/");
try {
	require_once 'SmartyGea/SmartyGea.class.php';
	require_once 'Zend/Registry.php';
	require_once 'Zend/Controller/Front.php';
	require_once 'Zend/Config/Xml.php';
	require_once 'Zend/Db.php';
	require_once 'Zend/Auth.php';
	require_once 'Usuarios/Gea_Zend_Acl_Factory.class.php';
	require_once 'Examenes/Examen.class.php';
	require_once 'Examenes/ReporteAlumno.class.php';
	/**
	 * Inicializamos el Zend_Registry
	 */
	$registry = new Zend_Registry(array (), ArrayObject :: ARRAY_AS_PROPS);
	Zend_Registry :: setInstance($registry);

	/**
	 * Inicializamos el Zend_Config_Xml
	 */

	$config = new Zend_Config_Xml('webconfig.xml', 'gea');
	$registry->config = $config;
	/**
	 * Inicializamos el adapter de la bd para guardarlo en el registro.
	 */

	$dbAdapter = Zend_Db :: factory('Mysqli', array (
		'host' => $config->database->host,
		'username' => $config->database->username,
		'password' => $config->database->password,
		'dbname' => $config->database->name
	));
	$registry->db = $dbAdapter;

	/**
	 * Inicializamos el smarty
	 */
	$smarty = new SmartyGea();
	$smarty->assign('titulo', $config->appSettings->titulo);
	$userName = Zend_Auth :: getInstance()->getIdentity()->USUARIO_NOMBRE;
	$smarty->assign('loginStatus', $userName);
	$registry->smarty = $smarty;
	/**
	 * Inicializamos  el Zend_Acl
	 */
	$acl = Gea_Zend_Acl_Factory :: getInstance($dbAdapter);
	$registry->acl = $acl;

	$front = Zend_Controller_Front :: getInstance();
	$front->setParam('noViewRenderer', true);
	$front->setModuleControllerDirectoryName('controllers');
	$front->addModuleDirectory('application/modules');
	$front->dispatch();
} catch (Exception $e) {
	echo $e->getMessage();
}
?>